package com.youpai.platform.jarvis.api;

import com.youpai.platform.jarvis.entity.resp.BaseResponse;
import com.youpai.platform.jarvis.service.FileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @time: 2022/8/9 11:35 上午
 * @author: welles
 * @description: jar上传
 */
@Slf4j
@Controller
public class JarUpload {

    @Resource
    private FileService fileService;

    @ResponseBody
    @PostMapping(value = "/upload")
    public BaseResponse<Void> uploadFile(@RequestParam("file") MultipartFile file) {
        fileService.uploadFile(file);
        return BaseResponse.success();
    }

    @GetMapping(value = "/")
    public String Jarvis() {
        return "jarvis";
    }
}